#include <stdio.h>
char * intToRoman(int num);
char s[20];
int main(void){
	printf("%s", intToRoman(4));	
}

char * intToRoman(int num){
    int n=0,i=1;
    char *p=s;
    n=num/1000;
    num%=1000;
    for ( i=1;i<=n;i++ ){
        *p++='M';
    }
    n=num/900;
    num%=900;
    for ( i=1;i<=n;i++ ){
        *p++='C';
        *p++='M';
    }
    n=num/500;
    num%=500;
    for ( i=1;i<=n;i++ ){
        *p++='D';
    }
    n=num/400;
    num%=400;
    for ( i=1;i<=n;i++ ){
        *p++='C';
        *p++='D';
    }
    n=num/100;
    num%=100;
    for ( i=1;i<=n;i++ ){
        *p++='C';
    }
    n=num/90;
    num%=90;
    for ( i=1;i<=n;i++ ){
        *p++='X';
        *p++='C';
    }
    n=num/50;
    num%=50;
    for ( i=1;i<=n;i++ ){
        *p++='L';
    }
    n=num/40;
    num%=40;
    for ( i=1;i<=n;i++ ){
        *p++='X';
        *p++='L';
    }
    n=num/10;
    num%=10;
    for ( i=1;i<=n;i++ ){
        *p++='X';
    }
    n=num/9;
    num%=9;
    for ( i=1;i<=n;i++ ){
        *p++='I';
        *p++='X';
    }
    n=num/5;
    num%=5;
    for ( i=1;i<=n;i++ ){
        *p++='V';
    }
    n=num/4;
    num%=4;
    for ( i=1;i<=n;i++ ){
        *p++='I';
        *p++='V';
    }
    n=num;
    for ( i=1;i<=n;i++ ){
        *p++='I';
    }
    return s;
}
